﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Module_News.ascx.cs" Inherits="Module_News" %>
    
    
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
    AutoGenerateColumns="False" DataSourceID="SqlDataSource1" Width="600px" 
    BackColor="White" GridLines="None">
            <Columns>
                <asp:BoundField DataField="id" HeaderText="id" ReadOnly="True">
                 <HeaderStyle HorizontalAlign="Left" Width="10px"  CssClass="hidden"/>
                    <ItemStyle HorizontalAlign="Left" Width="10px"  CssClass="hidden"/>
                </asp:BoundField>
                
                <asp:TemplateField HeaderText="序号">
                  <HeaderStyle HorizontalAlign="Center" Width="50px" />
                  <ItemStyle HorizontalAlign="Center" Width="50px" />
                  <ItemTemplate> 
                     <%# Container.DataItemIndex + 1%> 
                  </ItemTemplate>
               </asp:TemplateField>
                
               <asp:TemplateField HeaderText="标题">
                 <HeaderStyle HorizontalAlign="Left" Width="350px" />
                 <ItemStyle HorizontalAlign="Left" Width="350px" />
                <ItemTemplate>
                     <a href='./News_Show.aspx?NewsID=<%# Eval("id") %>' title='<%#Eval("id") %>' target="_self" >
                                    <%# Eval("title") %></a><br />                                            
                </ItemTemplate>
               </asp:TemplateField>
                               
                <asp:BoundField DataField="publishtime" HeaderText="发布时间" ReadOnly="True" HtmlEncode="false"
                    DataFormatString="{0:yyyy-MM-dd HH:mm:ss }">
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Center" Width="200px" />
                </asp:BoundField>
            </Columns>
            <HeaderStyle BackColor="#003366" Height="30px" />
            <AlternatingRowStyle BackColor="#99CCFF" Wrap="False" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
    ConnectionString="<%$ ConnectionStrings:allshareConnectionString3 %>" 
    ProviderName="<%$ ConnectionStrings:allshareConnectionString3.ProviderName %>" 
    SelectCommand="SELECT * FROM news WHERE enable=1 ORDER BY publishtime DESC">
</asp:SqlDataSource>
